Provides read-only access to the files contained within a single package, when the package is stored in LRM format. This is most commonly *.lrm files. The reader will only allow reading packages that are single Learning Resource files. Other types of files (for instance, multi-LR LRMs, license files or remote content files) will cause exceptions when files from the package are requested.
Namespace: Microsoft.LearningComponents
Assembly: Microsoft.LearningComponents.dll
| C# |
|
public class LrmPackageReader : PackageReader |
| Name | Description | |
| Ð | LrmPackageReader (Stream) | Initializes a new instance of the |
| Ð | LrmPackageReader (string) | Initializes a new instance of the |
| Ð | LrmPackageReader (string, ImpersonationBehavior) | Initializes a new instance of the |
| Name | Description | |
| ÐS | Create | Returns either a ZipPackageReader or LrmPackageReader, according to the type of package provided. Inherited from PackageReader. |
| Ð | CreateManifestNavigator () | Returns an XPathNavigator that points to the <manifest> node of the package manifest. Inherited from PackageReader. |
| Ï | Dispose | Releases all resources used by this object |
| Ð | Dispose () | This method supports the .NET Framework infrastructure and is not intended to be used directly from your code. Releases all resources used by the PackageReader. Inherited from PackageReader. |
| Ð | FileExists | Gets a value indicating whether a file exists in the LRM package. |
| Ð | GetFilePaths | Gets the collection of file paths in the package. |
| Ð | GetFileStream | Returns a System.IO.Stream for the file inside the LRM package referenced by filePath. |
| Ð | TransmitFile | Writes a file directly to a web page response. This method should be used whenever possible, as it has much better performance than reading a file into a stream and copying it to the response. |
The LRM file can be stored on the local hard drive, removable storage, or on a network file share accessible via a mapped drive letter or UNC path. However, note that performance may be very poor if the file name is a UNC path.
This class can be used to import a package contained in an LRM file, or for instance to access the contents of an LRM package.
The LRM package is unbundled to a temporary directory on the first call to FileExists or GetFileStream. This temporary directory is maintained for the life of the LrmPackageReader, and is deleted in the Dispose or finalizer. The identity passed into the constructor, or the current user must have permissions to allow unbundling and reading the package files in the temporary directory.
See PackageReader for examples of how classes based on PackageReader (such as this one) can be used.
The LrmPackageReader class calls unmanaged code. Since this assembly is used in the GAC, it has unmanaged code permissions implicitly.
The FileSystemPackageReader and LrmPackageReader classes both require FileIOPermission to write to the file system. Again, this is implicit as this assembly is a "full trust" assembly.